﻿@model BillBox.Models.Bill

@{
    ViewBag.Title = "View Bill";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row main">
    <div class="col-lg-12">
        <ol class="breadcrumb">
            <li>@Html.ActionLink("Home", "Index", "Default")</li>
            <li>@Html.ActionLink("Payment", "PaymentHistory", "Payment")</li>
            <li class="active">View Payment</li>
        </ol>
        <!--<h1 class="page-header">View Branch</h1>-->
        <div class="panel panel-default">
            <div class="panel-heading">
                Payment Information
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>

                                <th>@Html.DisplayNameFor(m => m.BillId)</th>
                                <th>@Html.DisplayNameFor(m => m.SubscriberId)</th>
                                <th>@Html.DisplayNameFor(m => m.AgentId)</th>
                                <th>@Html.DisplayNameFor(m => m.AgentBranchId)</th>
                                <th>@Html.DisplayNameFor(m => m.UserId)</th>
                                <th>@Html.DisplayNameFor(m => m.Date)</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>@Html.DisplayFor(m => m.BillId)</td>

                                <td>@Html.DisplayFor(m => m.Subscriber.Name)</td>

                                <td>@Html.DisplayFor(m => m.Agent.Name)</td>

                                <td>@Html.DisplayFor(m => m.AgentBranch.Name)</td>

                                <td>@Html.DisplayFor(m => m.User.Name)</td>

                                <td>@Html.DisplayFor(m => m.Date)</td>
                            </tr>
                        </tbody>

                    </table>
                </div>

                @if (Model.BillCaptureFields.Count() > 0)
                {
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover">
                            <caption>Capture Fields</caption>
                            <tbody>

                                @foreach (BillBox.Models.BillCaptureField captureField in Model.BillCaptureFields)
                                {
                                    <tr>
                                        <td>@captureField.CaptureField.DisplayName</td>
                                        <td>@captureField.Value</td>
                                    </tr>
                                }

                            </tbody>

                        </table>
                    </div>
                }
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>Payment(s)</th>
                                <th>Amount</th>
                                <th>Data</th>
                            </tr>
                        </thead>
                        <tbody>

                            @foreach (BillBox.Models.Payment payment in Model.Payments)
                            {
                                <tr>
                                    <td>@payment.PaymentMethod.Name</td>

                                    <td>@BillBox.Common.Util.DisplayForDollar(payment.Amount)</td>
                                    <td>
                                        @foreach (BillBox.Models.PaymentPaymentMethodCaptureField field in payment.PaymentPaymentMethodCaptureFields)
                                        {
                                            <span>@field.PaymentMethodCaptureField.DisplayName</span>
                                            <span>:&nbsp;</span>
                                            <span>@field.Value</span>
                                            <br />
                                        }
                                    </td>
                                </tr>
                            }

                        </tbody>

                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <ul class="action-menu">
                    <li>@Html.ActionLink("Unpost", "UnpostBill", new { billId = @Model.BillId }, new { @class = "btn btn-danger" })</li>
                    <li><a href="@Url.Action("ViewReceipt", new { billId = @Model.BillId })" target="_blank" class="btn btn-default">View Receipt</a></li>
                </ul>
            </div>
        </div>
    </div>
    <!-- /.col-lg-12 -->
</div>

